package com.zhupanlin.product.controller;

import com.zhupanlin.product.bean.Product;
import com.zhupanlin.product.service.ProductService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述信息：
 *
 * @author zhupanlin
 * @version 1.0
 * @date 2025/1/23 14:28
 */
@RestController
@RequestMapping("/api")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/product/{productId}")
    public Product getProduct(@PathVariable("productId") Long productId,
                              HttpServletRequest request) {
        String header = request.getHeader("X-Token");
        System.out.println(header);
        Product product = productService.getProductById(productId);
        return product;

    }

}